import java.util.Vector;

import javax.swing.AbstractListModel;
import javax.swing.ComboBoxModel;

public class MyComboBoxModel extends AbstractListModel implements ComboBoxModel{

		private String selection;
		private Vector<String> list;
		
		public MyComboBoxModel(){
			init();
		}
		
		public void setList(Vector<String> initList){
			list = (Vector<String>) initList.clone();
		}
		
		public void init(){
			selection = null;
			list = new Vector<String>();
			list.add("");
		}
		
		public void add(String s){
			list.add(s);
		}
		@Override
		public Object getElementAt(int arg0) {
			// TODO Auto-generated method stub
			return list.get(arg0);
		}

		@Override
		public int getSize() {
			// TODO Auto-generated method stub
			return list.size();
		}

		@Override
		public Object getSelectedItem() {
			// TODO Auto-generated method stub
			return selection;
		}

		@Override
		public void setSelectedItem(Object arg0) {
			// TODO Auto-generated method stub
			selection = (String) arg0;
		}
		
	}